#!/bin/bash


FILE="${FTP_HOME}/${PROJECT}/${PROJECT}_${GO_REVISION_MMSERL:0:6}.tar.gz"

echo "> fetch package:"
echo ${FILE}

if [ -f "${FILE}" ]; then
    sudo chmod -R 777 ${FTP_HOME}
    cp ${FILE} ${PROJECT}_artifact.tar.gz
    if [ $? = 0 ]; then
        echo "> done."
    else
        echo "> failed!"
        exit 1
    fi
else
    echo "> package not exists!"
    exit 1
fi

echo "> fetch configs:"
cp ${SCRIPTS_HOME}/${PROJECT}/sys.dev.config sys.dev.config && \
cp ${SCRIPTS_HOME}/${PROJECT}/sys.prt.config sys.prt.config

if [ $? = 0 ]; then
    echo "> done."
else
    echo "> failed!"
    exit 1
fi